(function() {
	module('PadlockModel Tests');

	test('Setup OK', function() {
		ok(true);
	});

	test(createLockValuesFromConf.name, function() {
		var values = createLockValuesFromConf('XXX OOO');
		var expected = [ 1, 1, 1, 0, -1, -1, -1 ];

		deepEqual(values, expected);
	});

	test('not allowed move', function() {
		var model = new PadlockModel(createLockValuesFromConf('XXX OOO'));

		model.move(1);

		deepEqual(model.getGrid(), createLockValuesFromConf('XXX OOO'));
	});

	test('out of bound move', function() {
		var model = new PadlockModel(createLockValuesFromConf('O OXOXX'));

		model.move(0);

		deepEqual(model.getGrid(), createLockValuesFromConf('O OXOXX'));
	});

	test('out of bound overtake', function() {
		var model = new PadlockModel(createLockValuesFromConf('XO OOXX'));

		model.move(1);

		deepEqual(model.getGrid(), createLockValuesFromConf('XO OOXX'));
	});

	test('free space move', function() {
		var model = new PadlockModel(createLockValuesFromConf('XXX OOO'));

		model.move(2);

		deepEqual(model.getGrid(), createLockValuesFromConf('XX XOOO'));
	});

	test('overtake move', function() {
		var model = new PadlockModel(createLockValuesFromConf('XXXO OO'));

		model.move(2);

		deepEqual(model.getGrid(), createLockValuesFromConf('XX OXOO'));
	});

	test('overtake move up', function() {
		var model = new PadlockModel(createLockValuesFromConf('XX XOOO'));

		model.move(4);

		deepEqual(model.getGrid(), createLockValuesFromConf('XXOX OO'));
	});

	test('won', function() {
		var model = new PadlockModel(createLockValuesFromConf('OOO XXX'));

		ok(model.hasWon());
	});

	test('not won', function() {
		var model = new PadlockModel(createLockValuesFromConf('OOX OXX'));

		ok(!model.hasWon());
	});

}());
